﻿{% extends "base.html" %}

{% block scripts %}
{% endblock %}

{% block content %}
        		<h1>Добавить партнера</h1>				
				<div class="add_partner">					
					<form class="form_2" action="/add_partner/{{ company.id }}/" method="post">
						{% if form.partner_url.errors %}
                            <dt><p class="error_message">{{ form.partner_url.errors|striptags }}</p></dt>
                        {% endif %}
                        <div class="block_header"><label for="id_partner_url">Вставьте ссылку на компанию</label></div>
					
						<div class="field_one"><input id="id_partner_url" name="partner_url" class="text_input" type="text"></div>
						
						<div class="buttons"><input class="button" type="submit" value="Добавить"></div>
					</form>

					<div class="base_block">
						<h2 class="block_header">Партнеры</h2>
					
						<ul class="block_content partners_list">
							{% for partner in company.partners.all %}
                            <li class="item">
                                <a href="/company/{{ partner.id }}/">
                                     <img class="pic"
                                     {% if partner.logo %}
                                        src="{{ partner.logo.url }}"
                                        {% if partner.logo.width > partner.logo.height %}
                                        width="47"
                                        {% else %}
                                        height="47"
                                        {% endif %}
                                     {% else %}
                                        src="/media/images/img_no.gif/"
                                        width="47" height="47"
                                     {% endif %}
                                     />
                                    {{ partner.name }}
                                </a>
								<ul class="options">
									<li class="option_item"><a href="/delete_partner/{{ company_id }}/{{ partner.id }}/">Удалить</a></li>
								</ul>
							</li>
                            {% endfor %}
						</ul>
						<a class="block_more" href="/all_partners/{{ company.id }}/">все партнеры</a>
					</div>
					
				</div>
				
{% endblock %}